package com.wanmait.wanmarecruit.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wanmait.wanmarecruit.service.HotSearchService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wanmait.wanmarecruit.mapper.HotSearchMapper;
import com.wanmait.wanmarecruit.entity.HotSearch;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class HotSearchServiceImpl extends ServiceImpl<HotSearchMapper, HotSearch> implements HotSearchService {

    @Resource
    private HotSearchMapper hotSearchMapper;

    @Override
    public PageInfo<HotSearch> getTopTwelveHotSearch() {
        PageHelper.startPage(1,12);
        LambdaQueryWrapper<HotSearch> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.orderByDesc(HotSearch::getSort);
        return new PageInfo<>(this.list(lambdaQueryWrapper));
    }
}
